package ebj.common.queue.request.queue;

import com.google.gson.Gson;

import ebj.common.queue.meta.QueryEntry;

public class QueryExecuteThread implements Runnable {
    private QueryEntry query;
    private int delay;
    
    String query_url = "http://localhost:8080/datasystem-realquery/report?report_param={\"data\":[\"clicks\"],\"filters\":{\"$and\":{\"campaign_id\":{\"$eq\":201405}}},\"group\":[\"hour\",\"time_stamp\",\"aff_id\"],\"settings\":{\"report_id\":\"report_id-100\",\"time\":{\"start\":1399942800,\"end\":1399946399,\"timezone\":0},\"data_source\":\"contrack_druid_datasource_ds\",\"pagination\":{\"size\":10000,\"page\":0}}}";
    
    public QueryExecuteThread() {}
    public QueryExecuteThread(QueryEntry query, int delay) {
        super();
        this.query = query;
        this.delay = delay;
    }

    public void run() {
        /*
         * 调用 解析查询语句 & druid请求发起程序
         */
        try {
            if (query != null) {
                System.out.println("运行的线程数"+Thread.activeCount());
                System.out.println("数据 [" + new Gson().toJson(query) + "] 已被消费.");
            }
            Thread.sleep(delay);
        } catch (InterruptedException e) {

        }
    }

}
